de.ueberdosis.mp3info.id3v2
Class ID3V2Frame

java.lang.Object
  |
  +--de.ueberdosis.mp3info.id3v2.ID3V2Frame
All Implemented Interfaces:
Defines
Direct Known Subclasses:
FrameAENC, FrameAPIC, FrameCOMM, FrameCOMR, FrameENCR, FrameEQUA, FrameETCO, FrameGEOB, FrameIPLS, FrameMCDI, FrameOWNE, FramePCNT, FramePOPM, FramePOSS, FrameRBUF, FrameRVRB, FrameSYLT, FrameSYTC, FrameT, FrameTXXX, FrameUFID, FrameUSER, FrameUSLT, FrameW, FrameWXXX

public class ID3V2Frame
extends java.lang.Object
implements Defines

Contains information about one ID3v2 frame.


Field Summary
protected  boolean dataChanged
          The information if a Frame has been altered.
protected  int deprecatedSince
          The information since when a a Frame is illegal To be changed by subclasses.
protected  int legalSince
          The information since when a Frame is legal To be changed by subclasses.
 
Fields inherited from interface de.ueberdosis.mp3info.Defines
DEFAULT_ENCODING, ID3V2_FOOTER_SIZE, ID3V2_FRAME_HEADER_SIZE, ID3V2_HEADER_SIZE, ID3V2_X_HEADER_SIZE, MP3_FRAME_HEADER_SIZE, SUPPORTED_NUMBER_OF_EXTENDED_FLAG_BYTES, testPositions, VERSION
 
Constructor Summary
ID3V2Frame(byte[] frameBytes)
          decoding constructor
ID3V2Frame(de.ueberdosis.mp3info.id3v2.ID3V2Frame frm)
          Copy constructor
ID3V2Frame(java.lang.String id)
           
 
Method Summary
 boolean canDisplay()
          Informs if the frame can create a component to display its contents To be overwritten by subclasses
 boolean canEdit()
          Informs if the frame can create a component to edit its contents To be overwritten by subclasses
 boolean containsData()
          Denotes if actual data are in this frame.
 de.ueberdosis.mp3info.gui.Id3JPanel createJPanel(boolean edit, boolean selfupdate)
          Creates a JPanel to display or edit the contents of the frame.
 de.ueberdosis.mp3info.gui.Id3Panel createPanel(boolean edit, boolean selfupdate)
          Creates a (AWT-)Panel to display or edit the contents of the frame.
 int deprecatedSince()
          Informs since which version of ID3V2 this Frame has become illegal Only major versions are supported.
 boolean equals(java.lang.Object o)
          Generic method.
 byte[] getData()
          creates an byte array containing the data in the Frame.
 boolean getDataLengthIndicator()
           
 boolean getFileAlterPreservation()
           
 java.lang.String getFrameID()
           
 long getSize()
           
 boolean getTagAlterPreservation()
           
 boolean getUnsynchronisation()
           
 boolean hasGroupingIdentity()
           
 boolean isAltered()
          Tells if the contained data are altered compared to those in the file.
 boolean isCompressed()
           
 boolean isEncrypted()
           
 boolean isReadOnly()
           
 boolean isValid()
          WinAmp likes to fill unused spaces with lots of 0's, so we have to test the frame for its validity.
 int legalSince()
          Informs since which version of ID3V2 this Frame is legal Only major versions are supported (eg.
 byte[] toByteArray()
          creates a byte array containing the whole Frame
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataChanged

protected boolean dataChanged
The information if a Frame has been altered. To be changed by subclasses


legalSince

protected int legalSince
The information since when a Frame is legal To be changed by subclasses.


deprecatedSince

protected int deprecatedSince
The information since when a a Frame is illegal To be changed by subclasses.

Constructor Detail

ID3V2Frame

public ID3V2Frame(java.lang.String id)

ID3V2Frame

public ID3V2Frame(de.ueberdosis.mp3info.id3v2.ID3V2Frame frm)
Copy constructor


ID3V2Frame

public ID3V2Frame(byte[] frameBytes)
           throws UndersizedException,
                  NotAnID3V2FrameException
decoding constructor

Parameters:
frameBytes - ID3V2_FRAME_HEADER_SIZE bytes that contain vital information.
Method Detail

getFrameID

public java.lang.String getFrameID()

getSize

public long getSize()

getTagAlterPreservation

public boolean getTagAlterPreservation()

getFileAlterPreservation

public boolean getFileAlterPreservation()

isReadOnly

public boolean isReadOnly()

isCompressed

public boolean isCompressed()

isEncrypted

public boolean isEncrypted()

hasGroupingIdentity

public boolean hasGroupingIdentity()

getUnsynchronisation

public boolean getUnsynchronisation()

getDataLengthIndicator

public boolean getDataLengthIndicator()

isAltered

public boolean isAltered()
Tells if the contained data are altered compared to those in the file.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isValid

public boolean isValid()
WinAmp likes to fill unused spaces with lots of 0's, so we have to test the frame for its validity. The easiest way is to check whether the ID COULD be valid.

Returns:
true if the frame seems to be valid

containsData

public boolean containsData()
Denotes if actual data are in this frame. Some Frames have a minimum size that is greater than the header although they don't contain any data. So I can't generally determine if a Frame is empty just by asking for its size.
To be overwritten by subclasses.


equals

public boolean equals(java.lang.Object o)
Generic method. All subclasses have a more sensible one!

Overrides:
equals in class java.lang.Object

toByteArray

public byte[] toByteArray()
creates a byte array containing the whole Frame


getData

public byte[] getData()
creates an byte array containing the data in the Frame. Dummy implementation, to be overwritten by the actual Frames


canDisplay

public boolean canDisplay()
Informs if the frame can create a component to display its contents To be overwritten by subclasses


canEdit

public boolean canEdit()
Informs if the frame can create a component to edit its contents To be overwritten by subclasses


createJPanel

public de.ueberdosis.mp3info.gui.Id3JPanel createJPanel(boolean edit,
                                                        boolean selfupdate)
Creates a JPanel to display or edit the contents of the frame. To be overwritten by subclasses. The results of canDisplay / canEdit are only binding for this method (ie. for JPanels). AWT-Panels may or may not be implemented.

Parameters:
edit - switches between display- (false) and edit-mode (true)
selfupdate - switches if the created component takes care of updating its data or not. Generally this means that the component carries its own update-button.
Of course, selfupdate is useless without edit set to true.
Returns:
a JPanel that can be used to display or edit the contents

createPanel

public de.ueberdosis.mp3info.gui.Id3Panel createPanel(boolean edit,
                                                      boolean selfupdate)
Creates a (AWT-)Panel to display or edit the contents of the frame. To be overwritten by subclasses. The results of canDisplay / canEdit are only binding for the other method (ie. for JComponents). AWT-Panel may or may not be implemented.
This is only intended for future extensibility, maybe someone will write extension/replacements for my Frame-implementations...

Parameters:
edit - switches between display- (false) and edit-mode (true)
selfupdate - switches if the created component takes care of updating its data or not. Generally this means that the Component carries its own update-button.
Of course, selfupdate is useless without edit set to true.
Returns:
a Panel that can be used to display or edit the contents

legalSince

public int legalSince()
Informs since which version of ID3V2 this Frame is legal Only major versions are supported (eg. 4 stands for ID3 v 2.4.0)

Returns:
a number between 0 and (currently) 4. -1 means the actual frame didn't overwrite the method.

deprecatedSince

public int deprecatedSince()
Informs since which version of ID3V2 this Frame has become illegal Only major versions are supported.

Returns:
a number between -1 and (currently) 4 denoting the first version that does NOT support this frame anymore. -1 (in combination with a sane return of legalSince ()) means this frame is not deprecated.